import React from 'react';
import base64url from "base64url";
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { Icon, List, WhiteSpace, Flex, NoticeBar,Progress,Button} from 'antd-mobile';
import styles from './democraticappraisal.less'



class democraticappraisal extends React.Component {
  constructor(props) {
    super(props);
    this.state = {}
  }
  addPy = () => {
    this.props.dispatch(
      routerRedux.push({
        pathname: "/work/democraticappraisal/addappraisal",
      })
    )
  };
  onItem=(code,name)=>{
    this.props.dispatch(
      routerRedux.push({
        pathname: "/work/democraticappraisal/dreviewDetail",
        query:{code:code,name:name}
      })
    )
  }

  render() {
    const orgList = [];
    const orgData = this.props.list;
    for (let key in orgData) {
      orgList.push(orgData[key])
    }
    const Item = List.Item;
    const Brief = Item.Brief;

    return (
      <div className="minzhu">

        <div className={styles.bg} style={{width: '97%', height: '3.8rem'}}>
          <div style={{width: '100%'}}>
            <div style={{width: '97%', fontSize: '0.3rem', float: 'left'}}>
              <Icon size="md" style={{verticalAlign: 'sub'}}type={require('../../../svgs/work/shu.svg')}/><span
              style={{fontSize: '0.41rem'}}>民主评议[2017年10月]</span></div>
          </div>
          <Flex style={{marginTop: '0.9rem', width: '100%'}} justify="center">
            <Flex.Item style={{textAlign: 'center'}}>
              <div style={{fontSize: '0.6rem'}}>152</div>
              <span style={{fontSize: '0.3rem'}}>优秀</span>
            </Flex.Item>
            <Flex.Item style={{textAlign: 'center'}}>
              <div style={{fontSize: '0.6rem'}}>154</div>
              <span style={{fontSize: '0.3rem'}}>合格</span>
            </Flex.Item>
            <Flex.Item style={{textAlign: 'center'}}>
              <div style={{fontSize: '0.6rem'}}>154</div>
              <span style={{fontSize: '0.3rem'}}>基本合格</span>
            </Flex.Item>
          </Flex>
          <Flex style={{marginTop: '0.3rem', width: '100%'}} justify="center">
            <Flex.Item style={{textAlign: 'center'}}>
              <div style={{fontSize: '0.6rem'}}>0</div>
              <span style={{fontSize: '0.3rem'}}>不合格</span>
            </Flex.Item>
            <Flex.Item style={{textAlign: 'center'}}>
              <div style={{fontSize: '0.6rem'}}>15</div>
              <span style={{fontSize: '0.3rem'}}>参加民主生活会</span>
            </Flex.Item>
            <Flex.Item style={{textAlign: 'center'}} onClick={this.addPy}>
              <div className={styles.svg1}><Icon size="lg" type={require('../../../svgs/work/jia.svg')}/></div>
              <span style={{fontSize: '0.3rem'}}>新增评议</span>
            </Flex.Item>
          </Flex>
        </div>
        <WhiteSpace/>
        <NoticeBar icon={<Icon type={require('../../../svgs/work/duoren.svg')}/>}
                   action={<span style={{color: '#a1a1a1'}}>5分钟前</span>}>
          &nbsp;&nbsp;某某支部召提交的活动待您审批
        </NoticeBar>
        <WhiteSpace/>
        <div>
          {this.props.list&&
            <List className="my-democracy">
              {
                orgList.map((it) => {
                  return <Item onClick={()=>this.onItem(it.code,it.name)}>
                    {it.name} <p className={styles.itemP} style={{fontSize: '0.26rem', color: '#B3B3B3'}}>
                    <span>优秀:12</span>
                    <span>合格:14</span>
                    <span>基本合格:56</span>
                    <span>参加民主省会会:3</span>
                  </p>
                  </Item>
                })
              }
            </List>
          }

        </div>
      </div>
    )
  }
}
function mapStateToProps({organizationss}) {
    return {
      list: organizationss.orgLists
    }
}
export default connect(mapStateToProps)(democraticappraisal);
